<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>鑫多多</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<script src="../js/angular/angular.min.js"></script>
		<script src="../js/angular/angular-resource.js"></script>
		<script src="../js/angular/common.js"></script>
		<script src="../js/common.js"></script>
		<script src="../js/mui.min.js"></script>
		<script src="../js/service/messageService.js"></script>
		<link rel="stylesheet" href="../css/mui.min.css">
		<style>
			html,
			body {
				background-color: #efeff4;
			}
			.title {
				padding: 20px 15px 10px;
				color: #6d6d72;
				font-size: 15px;
				background-color: #fff;
			}
		</style>
	</head>

	<body ng-app="mainApp" ng-controller="userServiceCtrl">
		<header class="mui-bar mui-bar-nav mui-bar-detail">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">选择客服</h1>
		</header>
		<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
			<div class="mui-scroll">
				<ul class="mui-table-view mui-table-view-chevron">
					<li class="mui-table-view-cell" ng-repeat="u in uList" ng-click="checkUser(u.id,u.realName)">
						<a class="mui-navigate-right">{{u.realName}}</a>
					</li>
					
				</ul>
			</div>
		</div>
		<script>
			(function($) {
				$.init({
					swipeBack:true //启用右滑关闭功能
				});
				$(".mui-scroll-wrapper").scroll({
					bounce: false,//滚动条是否有弹力默认是true
					indicators: false, //是否显示滚动条,默认是true
				});
			})(mui);
			
			mainApp.controller('userServiceCtrl', function($scope, $http,messageService) {
				mui.plusReady(function(){
					var success=function(data){
						$scope.uList=data.data;
					}
					
					var getAllSerUser=function(){
						messageService.getAllCusSerUser(success,error);
					}
					getAllSerUser();
					var success_t=function(data){
						mui.openWindow({
							url:'customService.html',
							id:'customService'+new Date().getMilliseconds(),
							preload: true,
							show: {
								aniShow: 'pop-in'
							},
							waiting: {
								autoShow: false
							},
							extras:{//参数传递
								token:data.data,
								cusName:$scope.realName,
								receiveUser:$scope.userId
							}
						});
					}
					//选择客服人
		        	$scope.checkUser=function(userId,realName){
		        		$scope.realName=realName;
		        		$scope.userId=userId;
		        		messageService.getUsrToken(userId,success_t,error);
		        	};
				});
	        	
			});
		</script>
	</body>
</html>